<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]-->
    <script type="text/javascript" src="../../../../lib/html5shiv.js?rev=@@hash"></script>
    <script type="text/javascript" src="../../../../lib/respond.min.js?rev=@@hash"></script>
    <!--[endif]-->
    <link rel="stylesheet" type="text/css" href="../../../../static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="../../../../static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="../../../../lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="../../../../static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="../../../../static/h-ui.admin/css/style.css" />
    <link rel="stylesheet" type="text/css" href="../../../../ht-css/Project.css" />
    <link rel="stylesheet" type="text/css" href="../../../../ht-css/style-q.css" />
    <!--[if IE 6]-->
    <script type="text/javascript" src="../../../../lib/DD_belatedPNG_0.0.8a-min.js?rev=@@hash"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <!--[endif]-->
    <title>ios版本号管理</title>
</head>
<body data-id="467">
<nav class="breadcrumb">移动端管理 <span class="c-gray en">&gt;</span> ios版本号管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px ;display:block" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<article class="page-container">
    <form class="ml-20 mr-20" id="form-member"  method="post">
        <div class="bk-gray bg-1 pd-20">
            <div>
                <input type="button" class="btn btn-secondary size-S radius powerButton 472" value="新增ios版本号" onclick="loadAdd()">
                <input type="button" class="btn btn-secondary size-S radius ml-10 powerButton 473 " value="操作日志" onclick="loadLog()">
                <input type="button" class="btn btn-secondary size-S radius ml-10 powerButton 474" value="安装包管理" onclick="loadApk()">
            </div>
        </div>
        <table class="table table-border table-bg table-hover table-sort mt-10" id="table">
            <thead class="text-c">
            <tr>
                <th>序号</th>
                <th>版本号</th>
                <th>更新内容</th>
                <th>文件名称</th>
                <th>下载路径</th>
                <th>是否强制更新</th>
                <th>状态</th>
                <th>更新时间</th>
                <th>创建人</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody id="versionTr">

            </tbody>
        </table>
        <div class="dataTables_wrapper goods_fanye clearfix mt-5">
            <div class="f-r pageturning M-box3"></div>
        </div>
        <div class="mt-40"></div>
    </form>

</article>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="../../../../lib/jquery/1.9.1/jquery.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../lib/layer/2.4/layer.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../static/h-ui/js/H-ui.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../static/h-ui.admin/js/H-ui.admin.js?rev=@@hash"></script> <!--/_footer 作为公共模版分离出去-->
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="../../../../lib/My97DatePicker/4.8/WdatePicker.js?rev=@@hash"></script>
<!--表单验证-->
<script type="text/javascript" src="../../../../lib/jquery.validation/1.14.0/jquery.validate.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../lib/jquery.validation/1.14.0/validate-methods.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../lib/jquery.validation/1.14.0/messages_zh.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../lib/datatables/1.10.0/jquery.dataTables.min.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../lib/laypage/1.2/laypage.js?rev=@@hash"></script>
<script type="text/javascript" src="../../../../ht-js/vue.min.js?rev=@@hash"></script>
<script src="../../../../ht-js/frame/doT.min.js?rev=@@hash"></script>
<script src="../../../../ht-js/public.js?rev=@@hash"></script>
<!--验证token-->
<script src="../../../../ht-js/verifyToken.js?rev=@@hash"></script>
<script src="../../../../ht-js/Project.js?rev=@@hash"></script>
<script src="../../../../ht-js/operation-js/operation_activity/activity_login.js?rev=@@hash"></script>
<!--引入分页-->
<link rel="stylesheet" href="../../../../lib/pagination/pagination.css">
<script src="../../../../lib/pagination/jquery.pagination.js?rev=@@hash"></script>
<link type="text/css" rel="stylesheet" href="../../../../ht-js/operation-js/time-js/jedate.css">
<script type="text/javascript" src="../../../../ht-js/operation-js/time-js/jquery.jedate.js?rev=@@hash"></script>
<!--权限控制-->
<script type="text/javascript" src="../../../../ht-js/power.js?rev=@@hash"></script>
<script>
    //到新増版本号
 /*   function loadAdd() {
        $("body").load("ios_version_add.html");
    }*/
    var title2=""
    var url=""
    function loadAdd() {
        title2="新增"
        url="ios_version_add.html"
        /* window.location.href=url;*/
        var index = layer.open({
            type: 2,
            title: title2,
            content: url
        });
        layer.full(index);
    }
    //到修改版本号
    function loadUpdate() {
        $("body").load("ios_version_update.html");
    }

    //到操作日志
    function loadLog() {
        $("body").load("ios_operation_log.html");
    }

    //到安装包管理
    function loadApk() {
        $("body").load("ios_upload_apk.html");
    }
    selectAppVersionByPage()
    function selectAppVersionByPage(){
        $.ajax({
                url: 'https://'+ window.location.host +'/api/admin/abaseservice/version/selectAppVersionByPage',
                cache: false, //禁用缓存
                type: "POST",
                dataType:"json",
                data:{"pageNum":1,"pageSize":5,"type":20},
                success: function(obj){
                    couponlist(obj.data, 0);
                    $('.M-box3').pagination({
                        pageCount: obj.data.totalPage,
                        jump: true,
                        coping: true,
                        prevContent: '上页',
                        nextContent: '下页',
                        callback: function (api) {
                            $.ajax({
                                url: 'https://'+ window.location.host +'/api/admin/abaseservice/version/selectAppVersionByPage',
                                cache: false, //禁用缓存
                                type: "POST",
                                dataType:"json",
                                data:{"pageNum":api.getCurrent(),"pageSize":5,"type":20},
                                success: function (obj) {
                                    couponlist(obj.data, 0);
                                },
                                error: function (XMLHttpRequest, textStatus, errorThrown) {
                                    alert(XMLHttpRequest);
                                }
                            });
                        }
                    });
                },
                error: function (XMLHttpRequest, textStatus, errorThrown) {
                    alert(XMLHttpRequest);
                }
            }
        )
    }

    var dataSource = new Array();
    //table的数据源
    var table;   //table对象
    dataSource = [];
    function couponlist(data, index){

        // var j = 0;
        sessionStorage.setItem("authorizedUsers", JSON.stringify(data));
        dataSource.splice(0,dataSource.length);//清空数组


        if(data !=null && data != ''){
            console.log(data)
            var datashu =data.startIndex;

            $.each(data.result, function (i, field) {

                let versionContent = "";
                let versiontent="";

                if (null != field.appVersionContentList && field.appVersionContentList.length>0) {
                    $.each(field.appVersionContentList,function (iii,vvv) {
                        versionContent += "<span>"+vvv.content+"</span><br>"
                        versiontent=vvv.content+"*"+versiontent;
                    })
                }

                console.log(versiontent)
                var datashus = datashu++
                var rowData = new Array();
                rowData.push(field.versionCode);
                rowData.push(versionContent);
                rowData.push(field.updateType);
                rowData.push(field.isOn);
                rowData.push(field.updatedAt);
                rowData.push(field.updateUser);
                rowData.push(datashu);
                rowData.push(field.id);
                rowData.push(versiontent);
                if (null != field.appVersionApk){
                    rowData.push(field.appVersionApk.fileName);
                    rowData.push(field.appVersionApk.filePath);
                }else {
                    rowData.push(field.appVersionApk);
                    rowData.push(field.appVersionApk);
                }
                dataSource.push(rowData);

            });
        }
        initDataTable(dataSource);

        function initDataTable(dataSource) {

            var dttable = $('#table').dataTable(); // 初始化dataTable，清空上一个值
            dttable.fnClearTable(); //清空一下table
            dttable.fnDestroy(); //还原初始化了的datatable
            $("#table").DataTable({
                // "order": false,
                "autoWidth": false,
                "ordering": false,
                "searching": false,
                "paging": false,
                "retrieve": true,
                "destroy": true,
                "bAutoWidth": true,
                "bLengthChange": true,
                "aLengthMenu": false,
                "oLanguage": {
                    "sLengthMenu": "每页显示 _MENU_ 条记录",
                    "sZeroRecords": "抱歉， 没有找到",
                    "sInfo": "从 _START_ 到 _END_ /共 _TOTAL_ 条数据",
                    "sInfoEmpty": "没有数据",
                    "sInfoFiltered": "(从 _MAX_ 条数据中检索)",
                    "oPaginate": {
                        "sFirst": "首页",
                        "sPrevious": "前一页",
                        "sNext": "后一页",
                        "sLast": "尾页"
                    },
                    "sZeroRecords": "没有检索到数据",
                },
                data: dataSource,
                columnDefs: [
                    {
                        "visible": true,
                        "targets": 0
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[6]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 0
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[0]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 1
                    },

                    {
                        "render": function (data, type, row, meta) {
                            var val = row[1]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 2
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[9]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 3
                    },{
                        "render": function (data, type, row, meta) {
                            var val = row[10]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 4
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = ""
                            if (row[2] == 10) {
                                val = '不强制更新'
                            }else if (row[2] == 20) {
                                val = '强制更新'
                            }if (row[2] == 0) {
                                val = '不升级'
                            }
                            return val;
                        },
                        "targets": 5
                    },

                    {
                        "render": function (data, type, row, meta) {
                            var val = ""
                            if (row[3] == 10) {
                                val = '关闭'
                            }else if (row[3] == 20) {
                                val = '开启'
                            }
                            return val;
                        },
                        "targets": 6
                    },

                    {
                        "render": function (data, type, row, meta) {
                            var val = row[4]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 7
                    },
                    {
                        "render": function (data, type, row, meta) {
                            var val = row[5]
                            if (val == undefined) {
                                val = ''
                            }
                            return val;
                        },
                        "targets": 8
                    },
                    {

                        "render": function (data, type, row, meta) {
                            var val='';
                            console.log(row)
                            val = '<a class="powerButton 475"><span class="list"  onclick="edit(\'ios_version_update.html?version=' + encodeURI(encodeURI(row)) + '\')">修改</span></a>';
                            return val;
                        },
                        "targets":9
                    }

                ]
            });
            //权限控制函数
            power()

        };
    }
    //修改
    var title=""
    function edit(url) {
        console.log(url)
        title="修改"
       /* window.location.href=url;*/
        var index = layer.open({
            type: 2,
            title: title,
            content: url
        });
        layer.full(index);
    }
</script>
</body>
</html>